package org.hank.demoproject.smartrefresh

import android.os.Bundle
import androidx.lifecycle.lifecycleScope
import github.nocamles.httphelper.base.BaseBindingActivity
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import org.hank.demoproject.R
import org.hank.demoproject.databinding.ActivitySmartrefreshBinding

/**
 *@auth: Hank
 *邮箱: cs16xiaoc1@163.com
 *创建时间: 2023/4/15 17:57
 *描述:
 */
class SmartRefreshActivity:BaseBindingActivity<ActivitySmartrefreshBinding>() {
    override val layoutResId: Int
        get() = R.layout.activity_smartrefresh

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        dataBinding.textTest.setOnClickListener {
            lifecycleScope.launch{
                dataBinding.smartRefresh.autoRefresh()
                delay(3000)
                dataBinding.smartRefresh.finishRefresh()
            }
        }
    }
}